@node Pre-Scheme type specifiers
@section Type specifiers

@cindex Pre-Scheme type inference
@cindex static types in Pre-Scheme
Although Pre-Scheme's static type system is based mostly on
Hindley-Milner type inference, with as little explicit type information
as possible, there are still places where it is necessary to specify
types explicitly; for example, @pxref{Pre-Scheme access to C functions
and macros}.  There are several different kinds of types with different
syntax:

@table @code
@item @var{type-name}
Symbols denote either record type or base types.  Record types are
defined with the @code{define-record-type} special form described
later; the following base types are defined:

@table @code
@item integer
Fixed-size integers (fixnums).  This type is translated into C as
@code{long}.  The actual size depends on the size of C's @code{long},
which on most architectures is 32 bits.

@item float
Floating-point data.  This type translates to C as @code{double}.

@item null
Type which has no value.  The @code{null} type translates to the C
@code{void} type.

@item unit
Type which has one value.  Actually, this, too, translates to C's
@code{void}, so that it has one value is not strictly true.

@item boolean
Booleans translate to the C @code{char} type.  @code{#t} is emitted as
@code{TRUE}, and @code{#f}, as @code{FALSE}; these are usually the same
as @code{1} &  @code{0}, respectively.

@item input-port
@item output-port
I/O ports.  On Unix, since Pre-Scheme uses @code{stdio}, these are
translated to @code{FILE *}s, @code{stdio} file streams.

@item char
Characters.  The size of characters is dependent on the underlying C
compiler's implementation of the @code{char} type.

@item address
Simple addresses for use in @embedref{Low-level Pre-Scheme memory
manipulation, Pre-Scheme's low-level memory manipulation primitives};
see that section for more details.
@end table

@item (=> (@var{argument-type} @dots{}) @var{return-type} @dots{})
The types of procedures, known as `arrow' types.

@item (^ @var{type})
The type of pointers that point to @var{type}.  Note that these are
distinct from the address type.  Pointer types are statically verified
to be coherent data, with no defined operations except for accessing
offsets in memory from the pointer --- @ie{} operations such as
@code{vector-ref} ---; addresses simply index bytes, on which only
direct dereferencing, but also arbitrary address arithmetic, is
available.  Pointers and addresses are @emph{not} interchangeable, and
and there is no way to convert between them, as that would break the
type safety of Pre-Scheme pointers.

@item (tuple @var{type} @dots{})
Multiple value types, internally used for argument & return types.
@end table
